<template>
  <view class="index" :key="index" :style="{'padding-top':realHeight>0?realHeight + 'px':navigationHeight + 'px'}">
    <view class="indexBox">
      <!-- 头部搜索开始 -->
      <view class="top_nav_wrap">
        <!-- #ifdef APP-PLUS -->
        <view class="status_bar">
          <!-- 状态栏 -->
        </view>
        <!-- #endif -->
        <view class="top-nav" :key="index" :style="{'height':realHeight>0?realHeight + 'px':50 + 'px','padding-top':statusBarH>0?statusBarH +'px':'','padding-right':menuWidth>0?menuWidth+'px':''}">
          <view class="top_l" @click="switchBtn">
            <view :class="['personal-icon1',userInfo.image_url?'active':'']" :key="index">
              <view v-if="userInfo.image_url" :style="{'border-radius':'50%','width':'100%','height':'100%','background-size':'cover','background-position':'center','background-image':'url('+getImgUrl(userInfo.image_url)+')'}" :key="index"></view>
              <!-- <image :src="getImgUrl(userInfo.image_url)" mode="" v-if="userInfo.image_url"></image> -->
              <image src="https://ruo.shanxiyf.com/public/images/index/personal1.png" mode="" v-else></image>
            </view>
            <view class="personal-icon2" v-if="!userInfo.image_url" :key="index"><image src="https://ruo.shanxiyf.com/public/images/index/personal-icon2.png" mode=""></image></view>
          </view>
          <view class="top_center" @click="toSearchPage">
            <view class="search-icon"><u-icon name="search" color="#999" size="32"></u-icon></view>
            <view class="inputBox">
              <input type="text" placeholder="早茶" disabled/>
            </view>
            <image src="https://ruo.shanxiyf.com/public/images/mine/scanCode.png" class="scanCode" @click.stop="toScanCode"></image>
          </view>
          <picker mode="multiSelector" :range="provinceList" @change="choiceCity" @columnchange="changeProvince" range-key="name" :key="index">
            <view class="top_r">
              <view class="location-icon"><u-icon name="map-fill" color="#FFAC3F" size="32"></u-icon></view>
              <view class="locationName">{{cityObj.name?cityObj.name:"定位中"}}</view>
            </view>
          </picker>
        </view>
      </view>
      <!-- 头部搜索结束 -->
      <!-- 头部轮播图菜单项开始 -->
      <view class="swiperBox">
        <swiper class="swiper" :indicator-dots="true" :circular="true" :autoplay="true" :interval="7000" :duration="1000">
          <swiper-item v-for="(item,index) in cateList" :key="index">
            <view class="menuBox">

              <view class="menuItem" v-for="(pitem,pindex) in item" :key="index" @click="toProductList" :data-id="pitem.id">
                <view class="menuIcon">
                  <image :src="getImgUrl(pitem.image_url)" mode=""></image>
                </view>
                <view class="menuName">{{pitem.name}}</view>
              </view>
            </view>
          </swiper-item>
        </swiper>
      </view>
      <!-- 头部轮播图草单项结束 -->
      <!-- 内容开始 -->
      <view class="index_contBox">
        <view class="screenBox">
          <view class="screenItem" @click="downBox(index)" v-for="(item,index) in popupList" :key="index">
            <view class="screenName">{{item.name}}</view>
            <u-icon name="arrow-down" size="16" color="#666"></u-icon>
          </view>
          <picker mode="multiSelector" :range="districtList" @change="choiceDistrict" range-key="name" @columnchange="areaChange">
            <view class="screenItem">
              <view class="screenName">{{businessObj.id?businessObj.name:"商圈"}}</view>
              <u-icon name="arrow-down" size="16" color="#666"></u-icon>
            </view>
          </picker>
        </view>
        <view class="contentList" v-if="conList.length>0">
          <view class="contentItem" v-for="(item,index) in conList" :key="index" :data-id="item.id" @click="toActivityDetails">
            <view class="contentItem_top">
              <view class="contentImage" :style="{'background-image':'url('+getImgUrl(item.ShopEvaluationExampleImage[0])+')'}" v-if="item.ShopEvaluationExampleImage.length>0">
                <!-- <image :src="getImgUrl(item.ShopEvaluationExampleImage[0].image_url)" mode="" v-if="item.ShopEvaluationExampleImage.length>0"></image> -->
              </view>
              <view class="content_R">
                <view class="contentNameBox">
                  <view class="contentItemName">{{item.title}}</view>
                  <image class="freeHot" src="/static/static/assets/hot.png" mode="widthFix" v-if="item.frozen_money==0"></image>
                  <view class="Royalties">稿费￥{{item.talent_money}}</view>
                </view>
                <view class="addressBox">
                  <view class="fieldBox">
                    <view class="recommendtitle fieldtitle">领域</view>
                    <view class="fieldtext">{{item.industry_name}}</view>
                    <!-- <view class="fieldtext" v-for="(pitem,pindex) in item.ShopEvaluationLabel" :key="pindex">{{pitem.label.name}}</view> -->
                  </view>

                  <view class="addressNum">
                    <view class="address">{{item.shop_name}}</view>
                    <view class="addressR">{{item.juli|numFilter}}km</view>

                  </view>

                </view>
                <view class="fansBox">
                  <view class="fansIcon" v-if="item.platform==1">
                    <image src="https://ruo.shanxiyf.com/public/images/index/fans.png" mode=""></image>
                  </view>
                  <view class="fansIcon" v-if="item.platform==2" style="background: #F40A0B;">
                    <image src="https://ruo.shanxiyf.com/public/images/mine/xiaohongshu_white.png" mode="widthFix" style="width: 36upx;"></image>
                  </view>
                  <view class="fansIcon" v-if="item.platform==3" style="background: #FFD974;">
                    <image src="https://ruo.shanxiyf.com/public/images/mine/weibo_white.png" mode="widthFix" style="width: 20upx;"></image>
                  </view>
                  <view class="fansIcon" v-if="item.platform==4" style="background: #F36326;">
                    <image src="https://ruo.shanxiyf.com/public/images/mine/dazong_white.png" mode="heightFix" style="height: 24upx;"></image>
                  </view>

                  <view class="fanstext"><text>粉丝数{{item.fans_num}}以上</text><text v-if="item.platform==4">;等级{{item.public_grade}}以上</text></view>
                </view>
                <view class="recommendBox">
                  <view class="recommendtitle">内容</view>
                  <view class="recommendtext">{{item.content}}</view>
                </view>

              </view>
            </view>
            <view class="contentItem_B">
              <view class="surplus">
                <!-- #ifdef APP -->
                分享达人可赚取<text>{{item.user_commission_money}}</text>元
                <!-- #endif -->
              </view>
              <view class="surplusNum">仅剩:<span style="color: #FF5555;">{{item.num}}</span>份</view>
            </view>
          </view>
        </view>
        <view v-else style="padding-top: 200upx;">
          <u-empty></u-empty>
        </view>
      </view>
      <!-- 内容结束 -->
      <!-- 下拉框开始 -->
      <view class="popupBox">
        <u-popup v-model="isScreen" mode="bottom" height="500upx">
          <scroll-view class="popupList" :scroll-y="true" @scrolltolower="loadMore">
            <view class="popupItem" v-for="(item,index) in downContent[currents]" :key="index" @click="popupItem(index)">
              <view class="popupName">{{item.text}}</view>
              <!-- <view v-if="currentIndex==index">
                <u-icon name="checkbox-mark" color='#FFAC3F'></u-icon>
              </view> -->
            </view>
          </scroll-view>
        </u-popup>
      </view>
      <!-- <view @click="test">点击点击</view> -->

      <!-- 下拉框结束 -->
      <!-- <view class="cooperationBox">商户合作</view> -->
      <!-- <view class="addBox" @click="toRelease"><u-icon name="plus" color="#fff" size="50"></u-icon></view> -->
    </view>
  </view>
</template>

<script>
import Login from "../../pages/pagethree/pages/Login/Login";

const app = getApp();
// import {cityAllData} from "../../common/city.js";
let indexTimer = null;
export default {
  data() {
    return {
      isScreen:false,
      currentIndex:0,
      popupList:[{name:"排序"},{name:"平台"},{name:"属性"}],
      downContent:[
        [{text:"离我最近"},{text:"稿费升序"},{text:"稿费降序"},{text:"新品优先"},{text:"粉丝数量升序"},{text:"粉丝数量降序"}],
        [{text:"抖音"},{text:"小红书"},{text:"微博"},{text:"大众点评"}],
        []
      ],
      districtList:[[],[]],
      currents:0,
      navigationHeight:0,
      realHeight:0,
      statusBarH:0,
      menuWidth:0,
      settingFlag:false,
      cateList:[],
      industryId:"",
      talent_money:false,
      new:false,
      platform:false,
      disFlag:false,
      lng:"",
      lat:"",
      page:1,
      conList:[],
      moreFlag:false,
      initLat:"",
      initLng:"",
      disIndex:0,
      talentIndex:1,
      fansFlag:false,
      cityStr:"",
      cityObj:{},
      businessObj:{},
      provinceList:[[],[]],
      userInfo:{},
      labelItem:[],
      labelPage:1,
      labelLimit:100,
      cityAllData:[]

    }
  },
  created(){
    if(!uni.getStorageSync("userId")){
      this.toLogin();
    }
    this.getAllCityDataMethod();
  },
  onReachBottom() {
    if(!this.moreFlag){
      return false;
    }
    this.moreFlag = false;
    this.page = this.page + 1;
    this.getList();
  },
  mounted() {

    app.$vm.setLongitudeAndLatitudeTime()
    this.userInfo = uni.getStorageSync("rmUser");
    //获取状态栏+导航栏的高度
    let _that = this;
    // #ifdef MP-WEIXIN
    //微信小程序胶囊按钮信息
    let res = uni.getMenuButtonBoundingClientRect();
    let { windowWidth, windowHeight } = uni.getSystemInfoSync();
    this.menuWidth = res.width + (windowWidth - res.right) + 10;
    // #endif
    uni.getSystemInfo({
      success(e) {
        // #ifdef MP-WEIXIN
        // 根据胶囊的位置计算导航栏的高度
        _that.realHeight = (res.top - e.statusBarHeight) *2 + res.height + e.statusBarHeight;
        _that.statusBarH = e.statusBarHeight;
        // #endif
        _that.navigationHeight = e.statusBarHeight + 50;
      }
    })
    this.getCity();
    this.getProvince(0);
    this.getCate();
    this.getList();
    // this.getLabel();
    if(uni.getStorageSync("cityData")){
      if(uni.getStorageSync("cityData")){
        this.cityStr = uni.getStorageSync("cityStr")
        this.cityObj = uni.getStorageSync("cityData");
        this.getArea();
      }else{
        this.$u.api.addressAnalysis({str:uni.getStorageSync('latitude')+","+uni.getStorageSync('longitude')}).then(res=>{
          let das = JSON.parse(res.data.data);
          this.cityStr = das.result.address_component.city;
          uni.setStorageSync("cityStr",this.cityStr)
          this.getCity();
        })
      }
    }else{
      // indexTimer = setInterval(()=>{
        Promise.all([app.$vm.indexInitFun()]).then(res=>{
          let para ={};
          if(uni.getStorageSync('latitude')){
            para= {str:uni.getStorageSync('latitude')+","+uni.getStorageSync('longitude')};
          }else{
            para = {str:39.987725+','+117.082094 }
          }
          // clearInterval(indexTimer);
          this.$u.api.addressAnalysis(para).then(res=>{
            let das = JSON.parse(res.data.data);
            this.cityStr = das.result.address_component.city;
            uni.setStorageSync("cityStr",this.cityStr)
            this.getCity();
            this.getList();
          })
        })
      // },3000)
      // Promise.all([app.$vm.indexInitFun()]).then(res=>{
      //   clearInterval(indexTimer);
      //   this.$u.api.addressAnalysis({str:app.$vm.globalData.latitude+","+app.$vm.globalData.longitude}).then(res=>{
      //     let das = JSON.parse(res.data.data);
      //     this.cityStr = das.result.address_component.city;
      //     uni.setStorageSync("cityStr",this.cityStr)
      //     this.getCity();
      //     this.getList();
      //   })
      // })
    }
    uni.$on("clearUser",(userInfo)=>{
      this.userInfo = userInfo;
    })
    uni.$on("shows",()=>{
      this.userInfo = uni.getStorageSync("rmUser");
      this.getProvince(0);
      this.getCate();
      // this.getLabel();
      if(app.$vm.globalData.latitude){
        this.cityStr = uni.getStorageSync("cityStr")
        this.cityObj = uni.getStorageSync("cityData");
        this.getArea();
        this.getList();
      }else{
        Promise.all([app.$vm.indexInitFun()]).then(res=>{
          this.$u.api.addressAnalysis({str:app.$vm.globalData.latitude+","+app.$vm.globalData.longitude}).then(res=>{
            let das = JSON.parse(res.data.data);
            this.cityStr = das.result.address_component.city;
            uni.setStorageSync("cityStr",this.cityStr)
            this.getCity();
          })
        })
        // app.$vm.indexInitFun.then(result=>{
        // 	this.$u.api.addressAnalysis({str:app.$vm.globalData.latitude+","+app.$vm.globalData.longitude}).then(res=>{
        // 		let das = JSON.parse(res.data.data);
        // 		this.cityStr = das.result.address_component.city;
        // 		this.getCity();
        // 	})
        // })
      }
    })
  },
  methods: {
    		  //获取城市信息
	getAllCityDataMethod(){
		this.$u.api.getCityAllData({}).then(res => {
				this.cityAllData = res.list;
		})
	},
    loadMore(){
      if(!this.labelMoreFlag){
        return false;
      }
      this.labelMoreFlag = false;
      this.labelPage = this.labelPage + 1;
      // this.getLabel();
    },


    toLogin(){
      // #ifdef MP-WEIXIN
      uni.switchTab({
        url:"/pages/pagefive/pages/wxLogin/wxLogin"
      })
      // #endif
      // #ifdef APP-PLUS
      uni.switchTab({
        url:"/pages/pagethree/pages/Login/Login"
      })
      // #endif
      // #ifdef MP-TOUTIAO
      uni.switchTab({
        url:"/pages/pagethree/pages/Login/Login"
      })
      // #endif
    },


    toScanCode(){
      let _this = app.$vm;
      uni.scanCode({
        success:res=>{
          // #ifdef MP-WEIXIN
          if (res.result) {
            let q = decodeURIComponent(res.result);
            if (q.indexOf("?") != -1) {
              if (_this.getArgs(q, "shareid")) {
                _this.globalData.shareid = _this.getArgs(q, "shareid");
              }
              if (_this.getArgs(q, "cpid")) {
                _this.globalData.cpid = _this.getArgs(q, "cpid");
              }
              if (_this.getArgs(q, "tgid")) {
                _this.globalData.tgid = _this.getArgs(q, "tgid");
              }
              if (_this.getArgs(q, "mdid")) {
                _this.globalData.mdid = _this.getArgs(q, "mdid");
              }
              let type = _this.getArgs(q, "type");
              if(type=='cp'){
                uni.navigateTo({
                  url:"/pages/pageone/pages/ActivityDetails/ActivityDetails?id="+_this.globalData.cpid
                })
              }
              if(type=='tg'){
                uni.navigateTo({
                  url:"/pages/pagethree/pages/OfferDetails/OfferDetails?id="+_this.globalData.cpid
                })
              }
              if(type=='tpnr'){
                uni.navigateTo({
                  url:"/pages/pagetwo/pages/FindDetail/FindDetail?id="+_this.getArgs(q, "nrid")
                })
              }
              if(type=='spnr'){
                uni.navigateTo({
                  url:"/pages/pagefive/pages/VideoDetail/VideoDetail?id="+_this.getArgs(q, "nrid")
                })
              }
              if(type=='gr'){
                uni.navigateTo({
                  url:"/pages/pageone/pages/Business-card/Business-card?id="+_this.getArgs(q, "usid")
                })
              }
            }
          }
          // #endif
          // #ifdef APP
          var args = res.result;
          if (args) {
            // 处理args参数，如直达到某新页面等
            let q = args;
            if (q.indexOf("?") != -1) {
              if (_this.getArgs(q, "shareid")) {
                _this.globalData.shareid = _this.getArgs(q, "shareid");
              }
              if (_this.getArgs(q, "cpid")) {
                _this.globalData.cpid = _this.getArgs(q, "cpid");
              }
              if (_this.getArgs(q, "tgid")) {
                _this.globalData.tgid = _this.getArgs(q, "tgid");
              }
              if (_this.getArgs(q, "mdid")) {
                _this.globalData.mdid = _this.getArgs(q, "mdid");
              }
              let type = _this.getArgs(q, "type");
              if(type=='cp'){
                uni.navigateTo({
                  url:"/pages/pageone/pages/ActivityDetails/ActivityDetails?id="+_this.globalData.cpid
                })
              }
              if(type=='tg'){
                uni.navigateTo({
                  url:"/pages/pagethree/pages/OfferDetails/OfferDetails?id="+_this.globalData.cpid
                })
              }
              if(type=='tpnr'){
                uni.navigateTo({
                  url:"/pages/pagetwo/pages/FindDetail/FindDetail?id="+_this.getArgs(q, "nrid")
                })
              }
              if(type=='spnr'){
                uni.navigateTo({
                  url:"/pages/pagefive/pages/VideoDetail/VideoDetail?id="+_this.getArgs(q, "nrid")
                })
              }
              if(type=='gr'){
                uni.navigateTo({
                  url:"/pages/pageone/pages/Business-card/Business-card?id="+_this.getArgs(q, "usid")
                })
              }
            }
          }
          // #endif
        }
      })
    },
    changeProvince(e){
      if(e.detail.column==0){
        if(e.detail.value == 0){
          this.provinceList.splice(1,1,[{id:0,name:"全部"}]);
        }else{
          this.getProvince(this.provinceList[0][e.detail.value].id);
        }
      }
    },
    choiceCity(e){
      this.cityObj = this.provinceList[1][e.detail.value[1]];
      uni.setStorageSync("cityData",this.cityObj)
      this.page = 1;
      this.businessObj = {};
      this.districtList = [[],[]];
      this.getList();
      this.getArea();
    },
    getProvince(id){
      let obj = {};
      obj.area_parent_id = id;
      this.$u.api.areaList(obj).then(res=>{
        if(id==0){
          res.data.unshift({id:0,name:"全部"})
          this.provinceList.splice(0,1,res.data);
          this.provinceList.splice(1,1,[{id:0,name:"全部"}]);
        }else{
          this.provinceList.splice(1,1,res.data);
        }
      })
    },
    choiceDistrict(e){
      if(e.detail.value[0] == 0){
        this.businessObj = {};
      }else{
        this.businessObj = this.districtList[1][e.detail.value[1]];
      }
      this.page = 1;
      this.getList();
    },
    areaChange(e){
      if(e.detail.column==0){
        if(e.detail.value==0){
          this.districtList.splice(1,1,[{name:"全部",id:-1}]);
        }else{
          this.getDistrict(this.districtList[0][e.detail.value].id);
        }
      }
    },
    getArea(){
      let obj = {};
      obj.id = this.cityObj.id?this.cityObj.id:110000;
      this.$u.api.areaList1(obj).then(res=>{
        res.list.unshift({name:"全部",id:-1})
        this.districtList.splice(0,1,res.list);
        this.districtList.splice(1,1,[{name:"全部",id:-1}]);
      })
    },
    getDistrict(id){
      let obj = {};
      obj.did = id;
      // obj.area_id = id
      this.$u.api.businessAreasList(obj).then(res=>{
        this.districtList.splice(1,1,res.list);
      })
    },
    getCity() {
      if (!uni.getStorageSync("cityStr")) {
        return false;
      }
      if (!uni.getStorageSync("cityData")) {
        let cityAllData = this.cityAllData;
        for (let i = 0; i < cityAllData.length; i++) {
          if (cityAllData[i].name.indexOf(uni.getStorageSync("cityStr")) != -1) {
            this.cityObj = cityAllData[i];
            this.cityObj.id = cityAllData[i].id;
            this.cityObj.name = cityAllData[i].name;
            uni.setStorageSync("cityData", this.cityObj)
            uni.setStorageSync("city_id", cityAllData[i].id)
            this.getArea();
            this.getList();
          }
        }
      }
    },
    getList(){
      let obj = {};
      if(this.cityObj.id){
        obj.city_id = this.cityObj.id;
      }
      if(this.businessObj.id){
        obj.business_areas_id = this.businessObj.id;
      }
      if(this.industryId){
        obj.industry_id = this.industryId;
      }
      if(this.talent_money){
        obj.talent_money = this.talentIndex;
      }
      // if(this.new){
      // 	obj.new = 1;
      // }
      if(this.platform){
        obj.platform = this.platform;
      }
      if(this.disFlag){
        obj.juli = this.disIndex;

      }
      if(this.fansFlag){
        obj.fans_num = this.fansIndex;
      }
      // obj.page = this.page;
      // if(uni.getStorageSync("longitude")){
      //   this.cityStr = uni.getStorageSync("cityStr")
      //   this.cityObj = uni.getStorageSync("cityData");
      //   this.getArea();
      //   this.getList();
      // }else{
        // obj.lat = app.$vm.globalData.latitude;
        // obj.lng = app.$vm.globalData.longitude;
        obj.lng = uni.getStorageSync("longitude")?uni.getStorageSync("longitude"):117.082094;
        obj.lat = uni.getStorageSync("latitude")?uni.getStorageSync("latitude"):39.987725;
        obj.page = this.page;
        this.$u.api.shopEvaluationListNoLogin(obj).then(res=>{
          if(this.page==1){
            this.conList = res.data.map(cur=>{
              cur.ShopEvaluationRelation =cur.ShopEvaluationRelation&&cur.ShopEvaluationRelation.map(pcur=>{
                let dis = app.$vm.getDistance(Number(pcur.Shop.dimension),Number(pcur.Shop.longitude));
                pcur.distance = dis;
                return pcur;
              })
              return cur;
            });

          }else{
            this.conList = this.conList.concat(res.data.map(cur=>{
              cur.ShopEvaluationRelation =cur.ShopEvaluationRelation&&cur.ShopEvaluationRelation.map(pcur=>{
                let dis = app.$vm.getDistance(Number(pcur.Shop.dimension),Number(pcur.Shop.longitude));
                pcur.distance = dis;
                return pcur;
              })
              return cur;
            }));
          }

        })
      // }

    },
    getImgUrl(url){
      if(url&&(url.indexOf("http://")!=-1||url.indexOf("https://")!=-1)){
        return url;
      }else{
        return app.$vm.globalData.imgBaseUrl + url;
      }
    },
    getCate(){
      this.$u.api.industryList().then(res=>{
        let arr = [];
        let arr1 = [];
        arr1.push({text:"全部",id:""});
        for(let i=0;i<res.data.length;i++){
          let obj = res.data[i];
          obj.text = obj.name;
          arr1.push(obj);
        }

        this.downContent[2] = arr1;
        // res.data.list.unshift({name:"商户合作"});
        let len = res.data.length%8;

        let ind = 0;
        if(len == 0){
          ind = Math.floor(res.data.length/8);
        }else{
          ind = Math.floor(res.data.length/8) + 1;
        }
        for(let i=0;i<ind;i++){
          let arr1 = [];
          for(let j=0;j<res.data.length;j++){
            if(j<8*(i+1)&&j>=8*i){
              arr1.push(res.data[j]);
            }
          }
          arr.push(arr1)
        }
        this.cateList = arr;
      })
    },
    // getLabel(){
    // 	let obj = {};
    // 	obj.type = 5;
    // 	obj.page = this.labelPage;
    // 	obj.limit = this.labelLimit;
    // 	this.$u.api.indexLabelList(obj).then(res=>{
    // 		let arrs = [];
    // 		for(let i=0;i<res.data.list.data.length;i++){
    // 			let flags = false;
    // 			let objs = res.data.list.data[i];
    // 			objs.checked = flags;
    // 			arrs.push(objs);
    // 		}
    // 		let arr1 = [];
    // 		if(this.page == 1){
    // 			// this.labelItem = arrs;
    // 			arr1.push({text:"全部",id:""});
    // 			for(let i=0;i<res.data.list.data.length;i++){
    // 				let obj = res.data.list.data[i];
    // 				obj.text = obj.name;
    // 				arr1.push(obj);
    // 			}
    // 			this.downContent[2] = arr1;
    // 		}else{
    // 			// this.labelItem = this.labelItem.concat(arrs);
    // 			for(let i=0;i<res.data.list.data.length;i++){
    // 				let obj = res.data.list.data[i];
    // 				obj.text = obj.name;
    // 				arr1.push(obj);
    // 			}
    // 			this.downContent[2] = this.downContent[2].concat(arr1)
    // 		}
    // 		if(this.page<res.data.list.last_page){
    // 			this.labelMoreFlag = true;
    // 		}else{
    // 			this.labelMoreFlag = false;
    // 		}
    // 	})
    // },
    toRelease(){
      uni.navigateTo({
        url:"/pages/pagefour/pages/Release/Release"
      })
    },
    //切换身份
    switchBtn(){
      uni.$emit("showSetting")
      // uni.showModal({
      // 	title:"是否切换身份？",
      // 	showCancel:true,
      // 	success(res) {
      // 		if(res.confirm){
      // 			uni.$emit('ServerIndex-page',false);
      // 		}
      // 	}
      // })
    },
    //详情
    toActivityDetails(e){
      let id = e.target.dataset.id || e.currentTarget.dataset.id;
      uni.navigateTo({
        url:"/pages/pageone/pages/ActivityDetails/ActivityDetails?id="+id
      })
    },
    //商品列表
    toProductList(e){
      let id = e.target.dataset.id || e.currentTarget.dataset.id;
      uni.navigateTo({
        url:"/pages/pagefour/pages/Product-list/Product-list?id="+id+"&cityid="+this.cityObj.id
      })
    },
    //搜索
    toSearchPage(){
      uni.navigateTo({
        url:"/pages/pagefour/pages/SearchPage/SearchPage"
      })
    },
    downBox(index){
      this.isScreen = true
      this.currents = index
    },
    popupItem(index){
      this.currentIndex= index
      this.isScreen = false
      let name;
      for(let i=0;i< this.downContent[this.currents].length; i++){
        if(i == index){
          name = this.downContent[this.currents][i].text
        }
      }
      this.popupList[this.currents].name = name;
      if(this.currents==2){
        this.industryId = this.downContent[this.currents][index].id;
      }
      if(this.currents==0){
        if(index==0){
          this.disFlag = true;
          this.talent_money = false;
          this.new = false;
          this.disIndex = 1;
          this.fansFlag = false;
          // uni.getLocation({
          // 	success:result=>{
          // 		this.lat = result.latitude;
          // 		this.lng = result.longitude;
          // 	}
          // })
        }else if(index==1){
          this.talent_money = true;
          this.disFlag = false;
          this.new = false;
          this.talentIndex = 1;
          this.fansFlag = false;
        }else if(index==2){
          this.talent_money = true;
          this.disFlag = false;
          this.new = false;
          this.talentIndex = 2;
          this.fansFlag = false;
        }else if(index==3){
          this.talent_money = false;
          this.disFlag = false;
          this.new = true;
          this.fansFlag = false;
        }else if(index==4){
          this.talent_money = false;
          this.disFlag = false;
          this.new = false;
          this.fansFlag = true;
          this.fansIndex = 1;
        }else if(index==5){
          this.talent_money = false;
          this.disFlag = false;
          this.new = false;
          this.fansFlag = true;
          this.fansIndex = 2;
        }
      }
      if(this.currents==1){
        this.platform = index+1;
      }
      this.page = 1;
      this.getList();
    }

  }
}
</script>

<style scoped lang="less">
.popupList{
  max-height: 600upx !important;
}
.status_bar {
  height: var(--status-bar-height);
  width: 100%;
}
.index{
  background-color: #F3F3F3;
  // height: calc(100vh - 100upx);
  height: 100vh;
  overflow: auto;
  // padding: 88upx 0 0 0;
  .indexBox{
    //头部搜索开始
    .top_nav_wrap{
      background-color: #F9F0E4;
      position: fixed;
      // top: 40upx;
      left: 0;
      right: 0;
      top: 0;
      z-index: 999;
      .top-nav{
        // background-color: #F9F0E4;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 24upx;
        // #ifdef MP-WEIXIN
        // height: 90upx;
        // #endif
        // #ifdef APP-PLUS
        height: 100upx !important;
        // #endif
        box-sizing: border-box;
        // z-index: 999;
        .top_l{
          width: 44upx;
          height: 44upx;
          position: relative;
          .personal-icon1{
            width: 32upx;
            height: 32upx;
            image{
              width: 100%;
              height: 100%;
            }
          }
          .personal-icon1.active{
            width: 100%;
            height: 100%;
            image{
              width: 100%;
              border-radius: 50%;
              height: 100%;
            }
          }
          .personal-icon2{
            position: absolute;
            bottom: 30upx;
            right: 0;
            width: 12upx;
            height: 12upx;
            image{
              width: 100%;
              height: 100%;
            }
          }
        }
        .top_center{
          display: flex;
          align-items: center;
          width: 526upx;
          // #ifdef MP-WEIXIN
          width: 300upx;
          // #endif
          height: 56upx;
          background: #FFFFFF;
          opacity: 1;
          border-radius: 34upx;
          padding: 12upx 32upx;
          box-sizing: border-box;
          position: relative;
          .scanCode{
            width: 40upx;
            height: 40upx;
            position: absolute;
            right: 32upx;
            top: 50%;
            transform: translateY(-50%);
          }
          .search-icon{
            width: 32upx;
            height: 32upx;
          }
          .inputBox{
            margin-left: 18upx;
            width: calc(100% - 114upx);

            input{
              width: 100%;
              font-size: 24upx;
            }

          }
        }
        .top_r{
          display: flex;
          align-items: center;
          .location-icon{

          }
          .locationName{
            font-size: 24upx;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #333333;
            margin-left: 8upx;
            max-width: 96upx;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }

      }
    }
  }
  //头部搜索结束
  // 轮播图开始
  .swiperBox{
    .swiper{
      height: 400upx;
      .menuBox{
        display: flex;
        flex-wrap: wrap;
        background: #FFFFFF;
        opacity: 1;
        padding: 32upx 47upx 64upx 47upx;
        // justify-content: space-between;
        height: 400upx;
        box-sizing: border-box;
        // .menuItem:nth-child(8n+1){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #FF4A4A 0%, #F63E2B 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+2){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #FBCF39 0%, #F6C72B 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+3){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #4ACEFF 0%, #2BC0F6 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+4){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #FF4ABD 0%, #F62BAC 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+5){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #FF924A 0%, #F6832B 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+6){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #8DFB39 0%, #83F62B 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+7){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #D64AFF 0%, #D62BF6 100%);
        // 	}
        // }
        // .menuItem:nth-child(8n+8){
        // 	.menuIcon{
        // 		background: linear-gradient(89deg, #FF4A98 0%, #F62B8A 100%);
        // 	}
        // }
        .menuItem{
          display: flex;
          flex-direction: column;
          align-items: center;
          margin-right: 86upx;
          margin-bottom: 32upx;

          .menuIcon{
            width: 80upx;
            height: 80upx;
            background: none;
            opacity: 1;
            border-radius: 8upx;
            display: flex;
            align-items: center;
            justify-content: center;
            image{
              width: 80upx;
              height: 80upx;
            }
          }

          .menuName{
            font-size: 24upx;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #333333;
            margin-top: 16upx;
            width: 100upx;
            text-align: center;
            // width: 80upx;
            white-space: nowrap;
            text-align: center;
          }
        }
        .menuItem:nth-child(4n+4){
          margin-right: 0;
        }
      }
    }
  }
  // 轮播图结束
  // 内容开始
  .index_contBox{
    padding: 32upx 24upx;
    .screenBox{
      display: flex;
      align-items: center;
      justify-content: space-between;
      .screenItem{
        display: flex;
        justify-content: center;
        align-items: center;
        min-width: 112upx;
        height: 36upx;
        background: #E5E5E5;
        opacity: 1;
        border-radius: 22upx;
        padding: 16upx 24upx;
        box-sizing: border-box;
        // margin-right: 48upx;
        .screenName{
          font-size: 20upx;
          font-family: Source Han Sans CN;
          font-weight: 400;
          line-height: 34upx;
          color: #666666;
          margin-right: 8upx;
          white-space: nowrap;
        }
      }
    }
    .contentList{
      margin-top: 24upx;
      .contentItem{
        width: 702upx;
        height: auto;
        background: #FFFFFF;
        opacity: 1;
        border-radius: 20upx;
        margin-bottom: 16upx;
        .contentItem_top{
          display: flex;
          padding: 32upx 0 24upx 24upx;
          .contentImage{
            width: 144upx;
            height: 144upx;
            border-radius: 8upx;
            margin-right: 16upx;
            background-position: center;
            background-size: cover;
            image{
              width: 100%;
              height: 100%;
              border-radius: 8upx;
            }
          }
          .content_R{
            width: calc(100% - 160upx);
            .contentNameBox{
              display: flex;
              align-items: center;
              // justify-content: space-between;
              position: relative;
              height: 36upx;
              .freeHot{
                width: 100upx;
                margin-left: 24upx;
              }
              .contentItemName{
                font-size: 24upx;
                color: #333333;
                max-width: calc(100% - 250upx);
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
              .Royalties{
                // width: 92upx;
                // height: 32upx;
                background: linear-gradient(206deg, #FAD96C 0%, #FFAC3F 100%);
                opacity: 1;
                border-radius: 20upx 0 0 20upx;
                font-size: 16upx;
                color: #fff;
                padding: 8upx;
                position: absolute;
                right: 0;
                top: 0;
              }
            }
            .addressBox{
              display: flex;
              align-items: center;
              justify-content: space-between;
              margin-top: 8upx;
              padding-right: 24upx;

              .addressNum{
                display: flex;
                align-items: center;
                .address{
                  // width: 300upx;
                  margin-right: 10upx;
                  font-size: 16upx;
                  font-family: Source Han Sans CN;
                  font-weight: 400;
                  color: #999999;
                }
                .addressR{
                  font-size: 16upx;
                  font-family: Source Han Sans CN;
                  font-weight: 400;
                  color: #999999;
                }
              }
            }
            .fansBox{
              display: flex;
              align-items: center;
              margin-top: 8upx;

              .fansIcon{
                display: flex;
                justify-content: center;
                align-items: center;
                width: 48upx;
                height: 24upx;
                background: #260A20;
                opacity: 1;
                border-radius: 4upx;
                image{
                  width: 24upx;
                  height: 24upx;
                }
              }
              .fanstext{
                width: calc(100% - 48upx);
                font-size: 20upx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                color: #333333;
                margin-left: 8upx;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
            }
            .recommendBox{
              display: flex;
              align-items: center;
              margin-top: 8upx;
              .recommendtitle{
                width: 48upx;
                height: 24upx;
                background: #FFAC3F;
                opacity: 1;
                border-radius: 4upx;
                font-size: 16upx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                text-align: center;
                line-height: 24upx;
                color: #FFFFFF;
                // padding: 4upx;
                // box-sizing: border-box;
                margin-right: 8upx;
              }
              .recommendtext{
                width: calc(100% - 48upx);
                font-size: 20upx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                color: #333333;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
            }
            .fieldBox{
              display: flex;
              align-items: center;
              // margin-top: 18upx;
              .fieldtitle{
                width: 48upx;
                height: 24upx;
                background: #FF5555;
                opacity: 1;
                border-radius: 4upx;
                font-size: 16upx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                line-height: 24upx;
                text-align: center;
                color: #FFFFFF;
                // padding: 4upx;
              }
              .fieldtext{
                // width: calc(100% - 48upx);
                font-size: 20upx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                color: #333333;
                margin-left: 8upx;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              }
            }
          }
        }
        .contentItem_B{
          display: flex;
          align-items: center;
          justify-content: space-between;
          padding: 0 24upx;
          height: 44upx;
          background-color: #FFEBD0;
          border-radius: 0 0 20upx 20upx;
          box-sizing: border-box;
          .surplus{
            font-size: 16upx;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #999999;
            text{
              font-size: 24upx;
              color: red;
            }
          }
          .surplusNum{
            font-size: 16upx;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: #333333;
          }
        }
      }
    }
  }
  // 内容结束
  // 下拉框开始
  .popupBox{
    .popupList{
      padding: 32upx 24upx;
      .popupItem{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 32upx 0;
        .popupName{
          font-size: 24upx;
          font-family: Source Han Sans CN;
          font-weight: 400;
          color: #333333;
        }
        .currentColor{
          font-size: 24upx;
          font-family: Source Han Sans CN;
          font-weight: 400;
          color: #FFAC3F;
        }
      }
    }
  }
  // 下拉框结束
  .cooperationBox{
    position: fixed;
    right: 24upx;
    bottom: 350upx;
    width: 112upx;
    height: 112upx;
    background: linear-gradient(90deg, #FF9F68 0%, #FC6843 100%);
    box-shadow: 0 0 12upx rgba(255, 128, 0, 0.5);
    border-radius: 50%;
    font-size: 20upx;
    font-family: Source Han Sans CN;
    font-weight: bold;
    color: #FFFFFF;
    text-align: center;
    line-height: 112upx;
    z-index: 999;
  }
  .addBox{
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    right: 24upx;
    bottom: 200upx;
    width: 112upx;
    height: 112upx;
    background: linear-gradient(90deg, #FFAC3F 0%, #FC8643 100%);
    box-shadow: 0 0 12upx rgba(255, 128, 0, 0.5);
    border-radius: 50%;
  }
}
</style>
